﻿using System.Collections.Generic;

namespace smp.ButterflyCakes.Models.InputModels.Order
{
    public class ShapeBuilderCalculationInput
    {
        public int Portions { get; set; }
        public int[] SelectedCells { get; set; }
        public string SelectedCellString { get; set; }
        public bool IsParty { get; set; }

        public void SetCellsFromString()
        {
            var list = new List<int>();
            foreach(var item in SelectedCellString.Split(','))
            {
                int value;
                if(int.TryParse(item, out value))
                {
                    list.Add(value);
                }
            }
            SelectedCells = list.ToArray();
        }
    }
}
